package control.action;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import business.dao.AnnexDao;
import business.dao.ArticleDao;
import business.dao.AtomDao;
import business.dao.AuthorityDao;
import business.dao.CascadeDao;
import business.dao.CurriculumDao;
import business.dao.NewsDao;
import business.dao.PhotoDAO;
import business.dao.PracticeDao;
import business.dao.ProexpDao;
import business.dao.RoleDao;
import business.dao.StatusDao;
import business.dao.StuDao;
import business.dao.StuachiDao;
import business.dao.StuexpeDao;
import business.dao.TeachclassDao;
import business.dao.TeacherDao;
import business.dao.UserDao;
import business.dao.WantedDao;
import business.dao.WorkDao;
import business.factory.daos;

import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {
	protected  HttpServletRequest request;
	protected HttpServletResponse response;
	protected HttpSession session;
	protected ServletContext application;
	
	public BaseAction() {
		super();
		request = ServletActionContext.getRequest();
		response = ServletActionContext.getResponse();
		session = request.getSession();
		application = ServletActionContext.getServletContext();
		
		ApplicationContext ctx = new ClassPathXmlApplicationContext("bean1.xml");
		
		daos.annexdao = ctx.getBean("annexdao",AnnexDao.class);
		daos.articledao = ctx.getBean("articledao",ArticleDao.class);
		daos.atomdao = ctx.getBean("atomdao",AtomDao.class);
		daos.authoritydao = ctx.getBean("authoritydao",AuthorityDao.class);
		daos.cascadedao = ctx.getBean("cascadedao",CascadeDao.class);
		daos.curriculumdao = ctx.getBean("curriculumdao",CurriculumDao.class);
		daos.newsdao = ctx.getBean("newsdao",NewsDao.class);
		daos.photodao = ctx.getBean("photodao",PhotoDAO.class);
		daos.practicedao = ctx.getBean("practicedao",PracticeDao.class);
		daos.proexpdao = ctx.getBean("proexpdao",ProexpDao.class);
		daos.roledao = ctx.getBean("roledao",RoleDao.class);
		daos.statusdao = ctx.getBean("statusdao",StatusDao.class);
		daos.stuachidao = ctx.getBean("stuachidao",StuachiDao.class);
		daos.studao = ctx.getBean("studao",StuDao.class);
		daos.stuexpedao = ctx.getBean("stuexpedao",StuexpeDao.class);
		daos.teachclassdao =ctx.getBean("teachclassdao",TeachclassDao.class);
		daos.teacherdao = ctx.getBean("teacherdao",TeacherDao.class);
		daos.userdao = ctx.getBean("userdao",UserDao.class);
		daos.wanteddao = ctx.getBean("wanteddao",WantedDao.class);
		daos.workdao = ctx.getBean("workdao",WorkDao.class);
	}
}
